//
//  XMN_GroupListCell.m
//  B段项目
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 谢美娜. All rights reserved.
//

#import "XMN_GroupListCell.h"
#import "Header.h"

@implementation XMN_GroupListCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleLabel = [[myTitleLabel alloc]init];
        [self addSubview:_titleLabel];
        
        _contentLabel = [[myContectLabel alloc]init];
        _contentLabel.numberOfLines = 0;
        _contentLabel.textColor = [UIColor grayColor];
        [self addSubview:_contentLabel];
        
        _timeLabel = [[UILabel alloc]init];
        [self addSubview:_timeLabel];
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.textColor = [UIColor lightGrayColor];
        
        _commentILView = [[XMN_ILView alloc]init];
        _commentILView.leftImageView.image = [UIImage imageNamed:@"XMN_comment"];
        _commentILView.rightLabel.textAlignment = 1;
        [self addSubview:_commentILView];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, self.contentView.frame.size.width - 20 * FitWidth, 30 * FitHeight);
    _contentLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 10 * FitHeight, _titleLabel.frame.size.width, 55 * FitWidth);
    _timeLabel.frame = CGRectMake(_contentLabel.frame.origin.x, _contentLabel.frame.origin.y + _contentLabel.frame.size.height + 10 * FitHeight, 150 * FitWidth, 15 * FitHeight);
    _commentILView.frame = CGRectMake(self.contentView.frame.size.width - 80 * FitWidth, _timeLabel.frame.origin.y - 2.5 * FitHeight, 70 * FitWidth, 20 * FitHeight);
}

-(void)setGroupList:(XMN_GroupList *)groupList{
    _titleLabel.text = groupList.title;
    _contentLabel.text = groupList.content;
    _timeLabel.text = groupList.addtime_f;
    _commentILView.rightLabel.text = [NSString stringWithFormat:@"%@", [groupList.counterList objectForKey:@"comment"]];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
